<template>
  <div>
    <!-- 举报管理 -->
    <el-form :inline="true" :model="formInline" class="demo-form-inline">
      <el-form-item label="举报时间">
        <el-select v-model="formInline.region" placeholder="请选择起始时间">
          <el-option label="区域一" value="shanghai"></el-option>
          <el-option label="区域二" value="beijing"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="姓名">
        <el-input
          v-model="formInline.user"
          placeholder="请输入学生/老师姓名"
        ></el-input>
      </el-form-item>
      <el-form-item label="处理进度">
        <el-select v-model="formInline.region" placeholder="请选择课程状态">
          <el-option label="区域一" value="shanghai"></el-option>
          <el-option label="区域二" value="beijing"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit()">搜索</el-button>
      </el-form-item>
    </el-form>
    <el-table
      :data="tableData"
      border
      style="width: 100%"
      header-cell-class-name="thead"
    >
      <el-table-column fixed="right" label="学生姓名" width="300">
        <template slot-scope="scope">
          <a>马冬梅</a>
        </template>
      </el-table-column>
      <el-table-column fixed="right" label="举报原因" width="300">
        <template slot-scope="scope">
          <p>言语辱骂</p>
        </template>
      </el-table-column>
      <el-table-column fixed="right" label="说明">
        <template slot-scope="scope">
          <p>
            该学生多次辱骂老师，每天晚上会发大量骚扰信息，严重影响老师正常工作。
          </p>
        </template>
      </el-table-column>
      <el-table-column fixed="right" label="老师姓名">
        <template slot-scope="scope">
          <p>于晓曼</p>
        </template>
      </el-table-column>
      <el-table-column fixed="right" label="举报时间">
        <template slot-scope="scope">
          <p>2019.12.27 15:32</p>
        </template>
      </el-table-column>
      <el-table-column fixed="right" label="进度">
        <template slot-scope="scope">
          <p>未处理</p>
        </template>
      </el-table-column>
      <el-table-column fixed="right" label="聊天记录">
        <template slot-scope="scope">
          <div>
            <a>点击查看</a>
          </div>
        </template>
      </el-table-column>
      <el-table-column fixed="right" label="操作">
        <template slot-scope="scope">
          <div>
            <a>删除</a>
          </div>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
      @size-change="sizeChangeHandle"
      @current-change="currentChangeHandle"
      :current-page="pageIndex"
      :page-sizes="[10, 20, 50, 100]"
      :page-size="pageSize"
      :total="totalPage"
      layout="total, sizes, prev, pager, next, jumper"
    ></el-pagination>
  </div>
</template>
<script>
import { queyEnumByTableName } from '@/api/api.js'
export default {
  name: 'asdasdaaqweqs',
  data () {
    return {
      pageIndex: 1,
      value: 2,
      value2: 3,
      pageSize: 10,
      totalPage: 0,
      formInline: {
        user: '',
        region: ''
      },
      tableData: [
        {
          date: '2016-05-02',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1518 弄'
        },
        {
          date: '2016-05-04',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1517 弄'
        },
        {
          date: '2016-05-01',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1519 弄'
        },
        {
          date: '2016-05-03',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1516 弄'
        }
      ]
    }
  },
  activated () {
    // this.getSelectData()
    // this.getTableData()
  },
  methods: {
    // 获取下拉菜单数据
    async getSelectData () {
      let res = await queyEnumByTableName({ tableName: 'nice_course' })
      if (res[0]) {
        return
      }
      console.log(res[1])
    },
    // 获取表数据
    getTableData () {},
    // 老师名字过滤器
    teacherNameArr (e, type) {
      if (type === 'all') {
        return e.join('、')
      } else {
        if (e && e.length < 2) {
          if (e[0].length > 6) {
            return e[0].substr(0, 6) + '...'
          } else {
            return e[0]
          }
        } else {
          let name = e[0] + '、' + e[1]
          if (name.length > 6) {
            return name.substr(0, 6) + '...'
          } else {
            return name
          }
        }
      }
    },
    // 字数过滤器
    fontLength (e) {
      if (e && e.length > 20) {
        return e.substr(0, 20) + '...'
      } else {
        return e
      }
    },
    setCourseTerm () {
      this.$router.push({ name: 'course-term' })
    },
    setClassHour () {
      this.$router.push({ name: 'class-hour' })
    },
    addUpdateCourse (e) {
      if (e) {
        this.$router.push({ name: 'add-update-class', query: { id: 1 } })
      } else {
        this.$router.push({ name: 'add-update-class' })
      }
    },
    onSubmit () {
      console.log('submit!')
    },
    // 每页数
    sizeChangeHandle (val) {
      this.pageSize = val
      this.pageIndex = 1
      this.getDataList()
    },
    // 当前页
    currentChangeHandle (val) {
      this.pageIndex = val
      this.queryPageList()
    }
  }
}
</script>
<style scoped>
abbr {
  text-decoration: none;
}
.z-display-flex {
  display: flex;
}
a {
  cursor: pointer;
}
</style>
